home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.2 Development Libraries / SGI IRIX 6.2 Development Libraries.iso / dist / gl_dev.idb / usr / share / src / OpenGL / demos / fadeflip / myimage.h.z / myimage.h
Encoding:
C/C++ Source or Header  |  1996-03-15  |  2.2 KB  |  81 lines

  1. #ifndef    __GL_IMAGE_H__
  2. #define    __GL_IMAGE_H__
  3. /*
  4.  *    Defines for image files . . . .
  5.  *
  6.  *              Paul Haeberli - 1984
  7.  *      Look in /usr/people/4Dgifts/iristools/imgtools for example code!
  8.  *
  9.  */
  10.  
  11. #include <stdio.h>
  12.  
  13. #define IMAGIC     0732
  14.  
  15. /* colormap of images */
  16. #define CM_NORMAL        0    /* file contains rows of values which 
  17.                      * are either RGB values (zsize == 3) 
  18.                      * or greyramp values (zsize == 1) */
  19. #define CM_DITHERED        1
  20. #define CM_SCREEN        2    /* file contains data which is a screen
  21.                      * image; getrow returns buffer which 
  22.                      * can be displayed directly with 
  23.                      * writepixels */
  24. #define CM_COLORMAP        3    /* a colormap file */
  25.  
  26. #define TYPEMASK        0xff00
  27. #define BPPMASK            0x00ff
  28. #define ITYPE_VERBATIM        0x0000
  29. #define ITYPE_RLE        0x0100
  30. #define ISRLE(type)        (((type) & 0xff00) == ITYPE_RLE)
  31. #define ISVERBATIM(type)    (((type) & 0xff00) == ITYPE_VERBATIM)
  32. #define BPP(type)        ((type) & BPPMASK)
  33. #define RLE(bpp)        (ITYPE_RLE | (bpp))
  34. #define VERBATIM(bpp)        (ITYPE_VERBATIM | (bpp))
  35. #define    IBUFSIZE(pixels)    ((pixels+(pixels>>6))<<2)
  36. #define    RLE_NOP            0x00
  37.  
  38. #define    ierror(p)        (((p)->flags&_IOERR)!=0)
  39. #define    ifileno(p)        ((p)->file)
  40. #define    getpix(p)        (--(p)->cnt>=0 ? *(p)->ptr++ : ifilbuf(p))
  41. #define putpix(p,x)        (--(p)->cnt>=0 \
  42.                     ? ((int)(*(p)->ptr++=(unsigned)(x))) \
  43.                     : iflsbuf(p,(unsigned)(x)))
  44.  
  45. typedef struct {
  46.     unsigned short    imagic;        /* stuff saved on disk . . */
  47.     unsigned short     type;
  48.     unsigned short     dim;
  49.     unsigned short     xsize;
  50.     unsigned short     ysize;
  51.     unsigned short     zsize;
  52.     unsigned long     min;
  53.     unsigned long     max;
  54.     unsigned long    wastebytes;    
  55.     char         name[80];
  56.     unsigned long    colormap;
  57.  
  58.     long         file;        /* stuff used in core only */
  59.     unsigned short     flags;
  60.     short        dorev;
  61.     short        x;
  62.     short        y;
  63.     short        z;
  64.     short        cnt;
  65.     unsigned short    *ptr;
  66.     unsigned short    *base;
  67.     unsigned short    *tmpbuf;
  68.     unsigned long    offset;
  69.     unsigned long    rleend;        /* for rle images */
  70.     unsigned long    *rowstart;    /* for rle images */
  71.     long        *rowsize;    /* for rle images */
  72. } IMAGE;
  73.  
  74. void getrow(IMAGE *, unsigned short *, int, int);
  75. IMAGE *iopen(char *, char *);
  76. IMAGE *icreate();
  77. unsigned short *ibufalloc();
  78.  
  79. #define IMAGEDEF        /* for backwards compatibility */
  80. #endif    /* !__GL_IMAGE_H__ */
  81.